<!--  -->
<template>
      <div class="tabbaritem" @click="itemClick">
        <div v-if="!isActive"><slot name="item-icon"></slot></div>
        <div v-else><slot name="item-active-icon"></slot></div>
        <div :class={active:isActive}><slot name="item-text"></slot></div>
      </div>
</template>

<script>
export default {
  data () {
    return {
      
    }
  },
  props:{
      path:String,

  },
  computed:{
    isActive() {
      return this.$route.path.indexOf(this.path) !==-1
    }
  },
  methods:{
    itemClick() {
      this.$router.replace(this.path)
    }
  }
}
</script>

<style  scoped>
.tabbaritem{
    flex: 1;
    text-align: center;
    color: #000;
}
.tabbaritem >>>img {
  margin-top: 2px;
   width: 24px;
   height: 24px;
   vertical-align: middle;
}
.active{
  color: #ff0000;
}
</style>
